package com.h.extensions.listener;

import com.h.extensions.constant.Constants;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;

@Component
public class DelayListener {
    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void handMessage(Message message) throws UnsupportedEncodingException {
        //消费者逻辑
        System.out.printf("[delay.queue] %tc 接收到消息: %s /n",
                new Date(), new String(message.getBody(),"UTF-8"));
    }
}
